package com.qst.order.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qst.order.domain.DTO.*;
import com.qst.order.domain.Merchant;
import com.qst.order.domain.Order;
import com.qst.order.domain.OrderItem;
import com.qst.order.domain.VO.OrderListVO;
import com.qst.order.utils.Result;

public interface OrderService extends IService<Order> {

    /**
     * 创建订单
     *
     * @param orderCreatDTO 订单创建DTO
     * @param userId        用户ID
     * @return 是否创建成功
     */
    Order createOrder(OrderCreatDTO orderCreatDTO, Integer userId);

    Order createBatchOrder(OrderBatchRequest orderBatchRequest, Integer userId);


    IPage<OrderListVO> getOrderList(Integer page, Integer size, Integer userId, String status,
                                    String orderNO, String startDate, String endDate);

    OrderListVO  getDetailOrder(Integer orderId);

    boolean payOrder(PayDTO payDTO,Integer userId);

    boolean canceledOrder(Integer orderId);


    //IPage<OrderItem> getByMerchantIdAndStatusWithRelations(IPage<OrderItem> page, Integer merchantId, String itemStatus, String startDate, String endDate, String sortType, String searchKey);



    IPage<OrderItem> getByMerchantIdAndStatusWithRelations(IPage<OrderItem> page, Integer merchantId, String status, String startDate, String endDate, String sortType, String searchKey);




    //订单监控
    /**
     * 分页查询订单列表（带条件）
     */
    Result listOrders(OrderQueryParam param);

    /**
     * 查询订单详情（含订单项）
     */
    Result<OrderDetailDTO> getOrderDetail(Integer orderId);

    /**
     * 处理异常订单
     */
    Result<?> handleExceptionOrder(Integer orderId, String handleType, String remark);

}
